::XN5106C_AMR_build_all VERSION
::%1 -- VERSION number

::xn5106c_amr_build XN5106C COMMON FALSE FALSE TRUE TRUE FALSE
::%1 -- CHIP_ID: XN5106A or XN5106C
::%2 -- CUSTOMER_ID: COMMON=1 SUNRISE=2 SANXING=3 HEXING=4
::%3 -- DP_NODE: TRUE(Enable), FALSE(Disable)
::%4 -- LOG_ENA: TRUE(Enable), FALSE(Disable)
::%5 -- BIND_FLG: TRUE(Enable), FALSE(Disable)
::%6 -- TURBO_FLG: TRUE(Enable), FALSE(Disable), Only for XN5106C
::%7 -- SIMU_UART_FLG: TRUE(Enable), FALSE(Disable), Only for XN5106C
::           %1     %2    %3    %4   %5    %6    %7

@if "%1"=="" echo Error!!! Format: %CHIP_ID_DEF%_AMR_build_all Version number
@if "%1"=="" goto end

if not exist images\%1\%BOARD_ID_DEF% mkdir images\%1\%BOARD_ID_DEF%

if not exist images\%1\%BOARD_ID_DEF%\axf mkdir images\%1\%BOARD_ID_DEF%\axf
rm -rf images/%1/%BOARD_ID_DEF%/axf/*.*
if not exist images\%1\%BOARD_ID_DEF%\lst mkdir images\%1\%BOARD_ID_DEF%\lst
rm -rf images/%1/%BOARD_ID_DEF%/lst/*.*
if not exist images\%1\%BOARD_ID_DEF%\test mkdir images\%1\%BOARD_ID_DEF%\test
rm -rf images/%1/%BOARD_ID_DEF%/test/*.*


@if "%CHIP_ID_DEF%"=="XN5106A" goto end

@echo *************************************************************
@echo *       Build Versions( Board: %BOARD_ID_DEF%, Customer: %CUSTOMER_DEF% ) *
@echo *************************************************************

@if "%BOARD_ID_DEF%"=="S_RELAY_ON" (goto special_build) else (goto normal_build)

:special_build
@echo *************************************************************
@echo *                   Special Build Manage                    *
@echo *************************************************************

@SET CUSTOMER_DEF1=%CUSTOMER_DEF%
@SET CUSTOMER_DEF=FJASL
:: Common no BIND
@echo *************************************************************
@echo *       Build no BIND ( Board: %BOARD_ID_DEF%, Customer: %CUSTOMER_DEF% )*
@echo *************************************************************
make clean -f Makefile BOARD_ID=%BOARD_ID_DEF% CUSTOMER_ID=%CUSTOMER_DEF% DP_NODE_FLG=FALSE LOG_FLG=FALSE BIND_FLG=FALSE
make -f Makefile BOARD_ID=%BOARD_ID_DEF% CUSTOMER_ID=%CUSTOMER_DEF% DP_NODE_FLG=FALSE LOG_FLG=FALSE BIND_FLG=FALSE
mv images/*.axf images\%1\%BOARD_ID_DEF%\axf\
mv images/*.bin images\%1\%BOARD_ID_DEF%\
mv images/*.lst images\%1\%BOARD_ID_DEF%\lst\

:: Restor Customer_ID
@SET CUSTOMER_DEF=%CUSTOMER_DEF1%

:normal_build
@echo *************************************************************
@echo *                   Normal Build Manage                     *
@echo *************************************************************

:: Common BIND
@echo *************************************************************
@echo *       Build BIND ( Board: %BOARD_ID_DEF%, Customer: %CUSTOMER_DEF% )*
@echo *************************************************************
make clean -f Makefile BOARD_ID=%BOARD_ID_DEF% CUSTOMER_ID=%CUSTOMER_DEF% DP_NODE_FLG=FALSE LOG_FLG=FALSE BIND_FLG=TRUE
make -f Makefile BOARD_ID=%BOARD_ID_DEF% CUSTOMER_ID=%CUSTOMER_DEF% DP_NODE_FLG=FALSE LOG_FLG=FALSE BIND_FLG=TRUE
mv images/*.axf images\%1\%BOARD_ID_DEF%\axf\
mv images/*.bin images\%1\%BOARD_ID_DEF%\
mv images/*.lst images\%1\%BOARD_ID_DEF%\lst\


:: Common BIND
@echo *************************************************************
@echo *       Build BIND ( Board: %BOARD_ID_DEF%, Customer: FOREIGN )*
@echo *************************************************************
make clean -f Makefile BOARD_ID=%BOARD_ID_DEF% CUSTOMER_ID=FOREIGN DP_NODE_FLG=FALSE LOG_FLG=FALSE BIND_FLG=TRUE
make -f Makefile BOARD_ID=%BOARD_ID_DEF% CUSTOMER_ID=FOREIGN DP_NODE_FLG=FALSE LOG_FLG=FALSE BIND_FLG=TRUE
mv images/*.axf images\%1\%BOARD_ID_DEF%\axf\
mv images/*.bin images\%1\%BOARD_ID_DEF%\
mv images/*.lst images\%1\%BOARD_ID_DEF%\lst\

:: Common no BIND
:: @echo *************************************************************
:: @echo *       Build no BIND ( Board: %BOARD_ID_DEF%, Customer: %CUSTOMER_DEF% )*
:: @echo *************************************************************
:: make clean -f Makefile BOARD_ID=%BOARD_ID_DEF% CUSTOMER_ID=%CUSTOMER_DEF% DP_NODE_FLG=FALSE LOG_FLG=FALSE BIND_FLG=FALSE
:: make -f Makefile BOARD_ID=%BOARD_ID_DEF% CUSTOMER_ID=%CUSTOMER_DEF% DP_NODE_FLG=FALSE LOG_FLG=FALSE BIND_FLG=FALSE
:: mv images/*.axf images\%1\%BOARD_ID_DEF%\axf\
:: mv images/*.bin images\%1\%BOARD_ID_DEF%\
:: mv images/*.lst images\%1\%BOARD_ID_DEF%\lst\


@echo *************************************************************
@echo *                        Build All Success                  *
@echo *************************************************************

:end
